//创建一个路由器，并暴露出去

//第一步：引入createRouter
import { createRouter, createWebHistory } from 'vue-router'

//引入一个个可能要呈现的组件
import Home from '@/views/Home.vue'
import About from '@/views/About.vue'
import News from '@/views/News.vue'
import Detail from '@/views/Detail.vue'

//第二步：创建路由器
const router = createRouter({
    //路由器的工作模式
    history: createWebHistory(),
    //路由规则
    routes: [
        { name: 'zhuye', path: '/home', component: Home },
        { name: 'guanyu', path: '/about', component: About },
        {
            name: 'xinwen',
            path: '/news',
            component: News,
            children: [
                { name: 'newDetail', path: 'detail', component: Detail }
            ]
        }
    ]
})

//第三步：暴露出去router
export default router